<script setup lang="ts">
import { getFileSrc } from '@/utils/image';
import { ref, watchEffect } from 'vue';

const props = defineProps<{
  path: string
}>()

const src = ref('')
async function load() {
  const url = await getFileSrc(props.path)
  src.value = url
}
watchEffect(() => {
  if (props.path) {
    load()
  }
})
</script>

<template>
  <el-image v-bind="{...$attrs, ...$props, src}" />
</template>
